bitkeeper revision 1.1159.79.7 (414ff215B9qHlFD0mQm03ssF02V-uA)
authorkaf24@freefall.cl.cam.ac.uk <kaf24@freefall.cl.cam.ac.uk>
Tue, 21 Sep 2004 09:19:17 +0000 (09:19 +0000)
committerkaf24@freefall.cl.cam.ac.uk <kaf24@freefall.cl.cam.ac.uk>
Tue, 21 Sep 2004 09:19:17 +0000 (09:19 +0000)
Strip image name from DOM0 cmdline.

xen/arch/x86/domain.c
xen/common/kernel.c

index d58aa01b7eea4462632c3c2775ec34ce9e90c5e8..ec27a5eb8da5f862701723eff022f87b4c13d4af 100644 (file)
@@ -862,7 +862,7 @@ int construct_dom0(struct domain *p,
     zap_low_mappings(); /* Do the same for the idle page tables. */
     
     /* Give up the VGA console if DOM0 is configured to grab it. */
-    console_endboot(strstr(cmdline, "tty0") != NULL);
+    console_endboot(cmdline && strstr(cmdline, "tty0"));
 
     /* DOM0 gets access to everything. */
     physdev_init_dom0(p);
index 1baef5caa9f4ed3fb8a5e08083a28e65a45df017..7b787a55369b0d2a333f48de199d3decad16a761 100644 (file)
@@ -148,7 +148,7 @@ void cmain(multiboot_info_t *mbi)
     {
         unsigned char *opt_end, *opt;
         while ( *cmdline == ' ' ) cmdline++;
-        cmdline = strchr(cmdline, ' ');
+        cmdline = strchr(cmdline, ' '); /* skip the image name */
         while ( cmdline != NULL )
         {
             while ( *cmdline == ' ' ) cmdline++;
@@ -326,6 +326,15 @@ void cmain(multiboot_info_t *mbi)
 
     shadow_mode_init();
 
+    /* Grab the DOM0 command line. Skip past the image name. */
+    cmdline = (unsigned char *)(mod[0].string ? __va(mod[0].string) : NULL);
+    if ( cmdline != NULL )
+    {
+        while ( *cmdline == ' ' ) cmdline++;
+        if ( (cmdline = strchr(cmdline, ' ')) != NULL )
+            while ( *cmdline == ' ' ) cmdline++;
+    }
+
     /*
      * We're going to setup domain0 using the module(s) that we stashed safely
      * above our heap. The second module, if present, is an initrd ramdisk.
@@ -338,7 +347,7 @@ void cmain(multiboot_info_t *mbi)
                         (mod[1].mod_start-mod[0].mod_start),
                         (mbi->mods_count == 1) ? 0 :
                         mod[mbi->mods_count-1].mod_end - mod[1].mod_start,
-                        __va(mod[0].string)) != 0)
+                        cmdline) != 0)
         panic("Could not set up DOM0 guest OS\n");
 
     /* The stash space for the initial kernel image can now be freed up. */